BANNERS WITH CLASS
Getting the word out in Egypt: Banners have been popular from ancient times. Imagine the frustration of early banner writers when they made an error. On-line banners are much easier to correct.
From ancient times banners have proclaimed events and advertised opportunities. Computers allow individuals to create personalized banners of varied sizes and styles. This program prints block versions of letters in user-specified sizes. It can be altered to create banners with such messages as PYTHON or NOT or POT.
Problem Statement
Write a Python program that reads letters supplied by the user and prints them down the screen in a block format. The program should first prompt the user for a value—the letter size—that specifies the number of printed lines and columns that will be used to print each letter. After reading the letter size, the program should prompt the user for six letters. Finally, it should read and print the six letters on the terminal screen in a block format.
You may assume that the user will provide a letter size value between 5 and 24, and that he or she will provide only letters. For example, here is how the program might work. The user input is indicated in boldface.
Type a size for the letters between 5 and 24? 9
Type six letters chosen from PYTHON: POT
* * * * * * * * *
* * * * * * * * *
* ** *
* ** *
* * * * * * * * *
* * * * * * * * *
* *
* *
* *
* * * * * * * * *
* * * * * * * * *
* ** *
* ** *
* ** *
* ** *
* ** *
* * * * * * * * *
* * * * * * * * *
(Block version of T is then printed.)
The program should be easy to modify, to add more letters and eventually to print banners.
Assume also that this program is being written as part of a collection of programs intended to display letters on a variety of output devices (terminal screens, printers, or plotters). Thus, instead of printing with print function, the program should make calls to three functions, DrawBar, DrawIndentedBar, and DrawTwoBars, to create the letters. The parameters for these functions include the number of lines—the height—and the number of columns—the width—needed to draw the corresponding figure. Here are descriptions of the functions.
- DrawBar, given height and width values, prints a bar composed of asterisks of the specified height and width. Its heading is
def DrawBar(height, width):
A sample call,
DrawBar(3, 5);
would produce the following output.
* * * * *
* * * * *
* * * * *
- DrawIndentedBar, given values for height, width, and the number of columns to indent, prints a bar indented by the specified amount. Its heading is
def DrawIndentedBar(height, width, indentAmt):
A sample call,
DrawIndentedBar(3, 5, 8);
would produce the following output. (Eight blanks precede each line of asterisks.)
* * * * *
* * * * *
* * * * *
- DrawTwoBars, given values for height, width, and amount of separation, prints two bars of the specified height and width, separated by the specified number of columns. Its heading is
def DrawTwoBars (height, width, separation):
A sample call,
DrawTwoBars(3, 5, 8);
would produce the following output. (Eight blanks separate each sequence of asterisks.)
* * * * ** * * * *
* * * * ** * * * *
* * * * ** * * * *
You may choose how to use these functions to print attractive-looking letters.